// Organism.hpp

#ifndef _ORGANISM_HPP_
#define _ORGANISM_HPP_

#include <string>

class Forest; 

class Organism
{

protected:
	
  /**
   * Reproduction probability for this species each timestep.
   */
  double reproProb;

  /**
   * The maximum age for this organism
   */
  int maxAge;

  /**
   * This Organism's current age.
   */
  int age; 
 
  /**
   * The type of organism.
   */
  std::string name;

  /**
   * Flag to store whether we need to be killed off on this time-step
   * or not
   */
  bool die;

  /**
   * Flag to store whether or not this organism reproduced
   */
  bool repr;

public:

  bool shouldDie() { return die; }

  bool shouldRepr() { return repr; }

  /**
   * Creates a new Organism of the given name, reproduction
   * probability and maximum age.
   */
  Organism(const std::string& n, double rProb, int max);

  /**
   * Copy an organism.
   */
  Organism(const Organism& org);

  /**
   * Advances this Organism through a timestep. 
   */
  void advance(Forest& forest);

  /**
   * The advance() function just takes birth and death from old age
   * into account. This function lets plants and animals die in other
   * ways that are different from one another.
   */
  virtual void specialAdvance(Forest& forest) = 0;

  const std::string& getName() const {return name;}

  virtual Organism* clone() const = 0;

};

#endif
